
Imports System
Imports System.Data.SqlClient


Namespace _2bMatesSite.BO
	''' <summary>
	''' Base class for messages.
	''' </summary>
	Public MustInherit Class BaseMessage
		Protected dateSent As New DateTime(0)
		Protected senderUID As Integer = -1
		Protected subject As String = Nothing
		Protected body As String = Nothing

		Protected messageRead As Boolean = False
		Protected messageDeleted As Boolean = False

		Public Sub New()
		End Sub

		Public ReadOnly Property DateSent() As DateTime
			Get
				Return dateSent
			End Get
		End Property

		Public ReadOnly Property SenderID() As Integer
			Get
				Return senderUID
			End Get
		End Property

		Public ReadOnly Property Sender() As User
			Get
				Return Users.GetUserByID(senderUID)
			End Get
		End Property

		Public Overridable Property Subject() As String
			Get
				Return subject
			End Get
			Set
				Throw New MessageException("Can not modify message subject.")
			End Set
		End Property

		Public Overridable Property Body() As String
			Get
				Return body
			End Get
			Set
				Throw New MessageException("Can not modify message body.")
			End Set
		End Property

		Public Property IsRead() As Boolean
			Get
				Return messageRead
			End Get

			Set
				messageRead = value
			End Set
		End Property

		Public Property IsMarkedDeleted() As Boolean
			Get
				Return messageDeleted
			End Get

			Set
				messageDeleted = value
			End Set
		End Property

		Public MustOverride ReadOnly Property ID() As Integer
		Public MustOverride Sub Delete()
		Public MustOverride Sub Save()
		Public MustOverride Sub Send()
	End Class
End Namespace






